Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Roger Swearingen 28 posts 49 karma points
    Oct 14, 2010 @ 04:05
    Roger Swearingen
    0

    Updating to New Schema | Problem with [contains(....)]

    Hey all,

    I have been able to update all of my XSLT so far to the new schema, but this one last issue is making my lose my hair.  I am probably missing something really basic, but after staring at it for so long it's time to ask for assistance.  I think the line giving me problem is this one:

    Old Schema:

    <

     

     

    xsl:for-each select="$speakerBioNode/node[data[@alias='speakerSessions' and contains(.,$videoShortTitle)]]">

    New Schema:

    <

     

     

    xsl:for-each select="$speakerBioNode/speakerSessions [contains(.,$videoShortTitle)]">

    It does not seem to be able to recognize a match to the 'speakerSessions' that contain the 'videoShortTitle'.

     

    Here is the rest of the code for context:

    <

     

     

    xsl:param name="currentPage"/>

    <

     

     

    xsl:variable name="videoShortTitle" select="$currentPage/videoShortTitle"/>

    <

     

     

    xsl:variable name="speakerBioNode" select="umbraco.library:GetXmlNodeById(/macro/SpeakerBioFolderId)"/>

    <

     

     

    xsl:variable name="speakerBioXML">

    <

     

     

    xsl:if test="$videoShortTitle != ''">

    <

     

     

    xsl:for-each select="$speakerBioNode/speakerSessions [contains(.,$videoShortTitle)]">

    <

     

     

    xsl:copy-of select="."/>

    </

     

     

    xsl:for-each>

    </

     

     

    xsl:if>

    </

     

     

    xsl:variable>

    <

     

     

    xsl:template match="/">

    <

     

     

    xsl:variable name="speakerXML" select="msxml:node-set($speakerBioXML)"/>

    <

     

     

    xsl:choose>

    <

     

     

    xsl:when test="count($speakerXML/node) &gt; 0">

    <

     

     

    xsl:for-each select="$speakerXML/node">

    <

     

     

    xsl:if test="speakerImage != ''">

    <

     

     

    img src="http://cdn.xxxxxx.com/xxxxxx/speaker/{speakerImage}" alt="{concat(speakerFirstName, ' ', speakerLastName, ', ', speakerTitle)}"></img>

    </

     

     

    xsl:if>

    </

     

     

    xsl:for-each>

    <

     

     

    xsl:for-each select="$speakerXML/node">

    <

     

     

    h3><xsl:value-of select="concat(speakerFirstName , ' ', speakerLastName)"/></h3>

    <

     

     

    xsl:if test="speakerCompany !=''">

    <

     

     

    h4><xsl:value-of select="speakerCompany"/></h4>

    <

     

     

    br/>

    </

     

     

    xsl:if>

    <

     

     

    xsl:if test="speakerTitle !=''">

    <

     

     

    h4><xsl:value-of select="speakerTitle"/></h4>

    <

     

     

    br/>

    </

     

     

    xsl:if>

    <

     

     

    xsl:if test="speakerBio !=''">

    <

     

     

    p><xsl:value-of select="umbraco.library:Replace(speakerBio, '&#xD;&#xA;', '')"/></p>

    <

     

     

    br/>

    </

     

     

    xsl:if>

    </

     

     

    xsl:for-each>

    </

     

     

    xsl:when>

    <

     

     

    xsl:otherwise>

    <

     

     

    xsl:choose>

    <

     

     

    xsl:when test="$currentPage/videoSpeakerName != ''">

    <

     

     

    h4><xsl:value-of select="$currentPage/videoSpeakerName"/></h4>

    </

     

     

    xsl:when>

    <

     

     

    xsl:otherwise>

    <

     

     

    h4>No speaker info available</h4>

    </

     

     

    xsl:otherwise>

    </

     

     

    xsl:choose>

    </

     

     

    xsl:otherwise>

    </

     

     

    xsl:choose>

    </

     

     

    xsl:template>

     

    Thanks in advance for any help!

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Oct 14, 2010 @ 09:22
    Chriztian Steinmeier
    1

    Hi Jeff,

    In the Old version you're asking for children of the $speakerBioNode that has a speakerSessions property containing the $videoShortTitle, but in the New version you're actually asking for the speakerSessions property on the $speakerBioNode itself - to correct it just add an asterisk in there to tell it that you want the children of the speakerBioNode with the speakerSessions property:

    <xsl:for-each select="$speakerBioNode/*[speakerSessions[contains(., $videoShortTitle)]]">

    (If you know the DocumentType alias you can use that instead of the asterisk for optimization)

    /Chriztian 

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies